package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AInstockMapper;
import com.ruoyi.system.domain.AInstock;
import com.ruoyi.system.service.IAInstockService;

/**
 * 材料入库Service业务层处理
 *
 */
@Service
public class AInstockServiceImpl implements IAInstockService 
{
    @Autowired
    private AInstockMapper aInstockMapper;

    /**
     * 查询材料入库
     * 
     * @param id 材料入库主键
     * @return 材料入库
     */
    @Override
    public AInstock selectAInstockById(Long id)
    {
        return aInstockMapper.selectAInstockById(id);
    }

    /**
     * 查询材料入库列表
     * 
     * @param aInstock 材料入库
     * @return 材料入库
     */
    @Override
    public List<AInstock> selectAInstockList(AInstock aInstock)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aInstock.setGroupId(deptId.toString());
        return aInstockMapper.selectAInstockList(aInstock);
    }

    /**
     * 新增材料入库
     * 
     * @param aInstock 材料入库
     * @return 结果
     */
    @Override
    public int insertAInstock(AInstock aInstock)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aInstock.setGroupId(deptId.toString());
        return aInstockMapper.insertAInstock(aInstock);
    }

    /**
     * 修改材料入库
     * 
     * @param aInstock 材料入库
     * @return 结果
     */
    @Override
    public int updateAInstock(AInstock aInstock)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aInstock.setGroupId(deptId.toString());
        return aInstockMapper.updateAInstock(aInstock);
    }

    /**
     * 批量删除材料入库
     * 
     * @param ids 需要删除的材料入库主键
     * @return 结果
     */
    @Override
    public int deleteAInstockByIds(Long[] ids)
    {
        return aInstockMapper.deleteAInstockByIds(ids);
    }

    /**
     * 删除材料入库信息
     * 
     * @param id 材料入库主键
     * @return 结果
     */
    @Override
    public int deleteAInstockById(Long id)
    {
        return aInstockMapper.deleteAInstockById(id);
    }
}
